package structure.proxy;

import org.springframework.cglib.proxy.Enhancer;

/**
 * @author dali
 * @date 2021-07-20 21:23
 * @Description
 */

public class ProxyFactory {
    public static Object getProxyInstance(Object target) {
        //创建一个工具类
        Enhancer enhancer=new Enhancer();
        //设置父类
        enhancer.setSuperclass(target.getClass());
        //设置回调函数
//        enhancer.setCallback(new UserCglibProxy());
        //返回代理对象
        return enhancer.create();
    }
}
